package com.hxl.dailyworksummary.settings;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import org.jetbrains.annotations.NotNull;

@State(name = "DailyWorkSummarySettings", storages = {@Storage("DailyWorkSummarySettings.xml")})
@Service
public final class SettingsState implements PersistentStateComponent<SettingsState.State> {
    private State myState = new State();

    public static class State {
        public String gitUsername = "";
        public String gitPassword = "";
        public String aiToken = "";
    }

    @Override
    public State getState() {
        return myState;
    }

    @Override
    public void loadState(@NotNull State state) {
        myState = state;
    }

    public static SettingsState getInstance() {
        return com.intellij.openapi.application.ApplicationManager.getApplication().getService(SettingsState.class);
    }
}